package com.tools;

import org.jsoup.Connection;
import org.jsoup.Jsoup;
import org.jsoup.select.Elements;

import java.io.IOException;

public class BaiTest {
    public static void simple(String url) throws IOException {
        Connection conn= getConn(url);
        Elements eles=conn.get().select("#content_left .result");
        for(int i=0;i<eles.size();i++){
            System.out.println(eles.get(i).text());
            System.out.println();
        }
    }

    public static Connection getConn(String url) {
        Connection conn = Jsoup.connect(url);
        conn.userAgent("Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.0 Safari/537.36");
        conn.timeout(30000);
        return conn;
    }
}
